<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <eForm ref="form" :sup_this="sup_this" />

    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :data="data"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      :default-expand-all="expandAll"
      :total="total"
      :max-height="gridMaxHeight"
      :show-page="false"
      grid-id="itemCategoryMngMainGridId"
      row-key="id"
      @selection-change="handleGridSelectionChange">
      <el-table-column label="类别名称" prop="catName" width="360px">
        <template slot="header" slot-scope="scope">
          <el-link @click="toggleTreeAllExpand">类别名称 <i class="el-icon-more el-icon--right" /> </el-link>
        </template>
        <template slot-scope="scope">
          <edit :data="scope.row" :sup_this="sup_this" />
        </template>
      </el-table-column>
      <DataGridColumn prop="thirdCode" label="类别编码" width="180px" />
    </DataGridTable>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import { parseTime } from '@/utils/index'
import initData from '@/mixins/initData'
import eHeader from './module/header'
import eForm from './module/form'
import edit from './module/edit'
import { loadDataUrl } from '@/api/base/itemCategory'

export default {
  components: { eHeader, eForm, edit },
  mixins: [initData],
  data() {
    return {
      delLoading: false,
      sup_this: this
    }
  },
  created() {
    this.url = loadDataUrl()
    this.searchToggle = true
    this.expandAll = true
    this.pageCount = false
    this.$nextTick(() => {
      this.init()
    })
  },
  methods: {
    parseTime,
    checkPermission,
    async beforeInit() {
      return true
    }
  }
}
</script>
